<?php
/**
 * Created by PhpStorm.
 * User: leo
 * Date: 2018/5/10
 * Time: 19:43
 */
header('Content-Type:application/json');
include '../classes/logincheck.php';
include '../classes/conn.php';
if(islogin()!='stu_login'){
    die('error');
}
$query1="select * from subsection where class='{$_POST['class_num']}'";
$query2="select * from subsection where class='{$_POST['class_num']}' and taken='1'";
$res1=mysql_query($query1);
$res2=mysql_query($query2);
if($res1&&$res2){
    $all=mysql_num_rows($res1);
    $taken=mysql_num_rows($res2);
    $data=(int)$taken/(int)$all;
    printf("%.2f",$data);
}